Add an internal API to get a read fd for a content object
authorColin Walters <walters@verbum.org>
Fri, 6 Feb 2015 02:49:49 +0000 (21:49 -0500)
committerColin Walters <walters@verbum.org>
Fri, 6 Feb 2015 02:50:26 +0000 (21:50 -0500)
This will be used by the static deltas work.

src/libostree/ostree-repo-private.h
src/libostree/ostree-repo.c

index e55ed60774bfc5e91fede6b0e1a4b0bd0e9a422a..f3f1cfe4e617057f05276234382d9f25d6d0cc22 100644 (file)
@@ -229,4 +229,11 @@ _ostree_repo_commit_trusted_content_bare (OstreeRepo          *self,
                                           GCancellable        *cancellable,
                                           GError             **error);
 
+gboolean
+_ostree_repo_read_bare_fd (OstreeRepo           *self,
+                           const char           *checksum,
+                           int                  *out_fd,
+                           GCancellable        *cancellable,
+                           GError             **error);
+                           
 G_END_DECLS
index 1de17a869795172ed97b78fe60889f8c8424e8b8..accb011bad42e71b397bbfd22850a0bba528bf00 100644 (file)
@@ -1875,6 +1875,24 @@ set_info_from_filemeta (GFileInfo  *info,
   return xattrs;
 }
 
+gboolean
+_ostree_repo_read_bare_fd (OstreeRepo           *self,
+                           const char           *checksum,
+                           int                  *out_fd,
+                           GCancellable        *cancellable,
+                           GError             **error)
+{
+  char loose_path_buf[_OSTREE_LOOSE_PATH_MAX];
+  
+  g_assert (self->mode == OSTREE_REPO_MODE_BARE ||
+            self->mode == OSTREE_REPO_MODE_BARE_USER);
+
+  _ostree_loose_path (loose_path_buf, checksum, OSTREE_OBJECT_TYPE_FILE, self->mode);
+  
+  return gs_file_openat_noatime (self->objects_dir_fd, loose_path_buf, out_fd,
+                               cancellable, error);
+}
+
 /**
  * ostree_repo_load_file:
  * @self: Repo